package design.observer;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.beans.BeanUtils;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;

/**
 * @author ZH
 */
@AllArgsConstructor
public class Consumer implements Observer {
    private String name;
    @SneakyThrows
    @Override
    public void update(Observable o, Object arg) {
        if ((boolean)arg){
            this.buy();
        }else {
            System.out.println(this.name+"表示:DDD永不下山!");
        }
    }
    public void buy(){
        System.out.println(this.name+"消费者买到了矿卡");
    }
    public void boom(){
        System.out.println(this.name+"的卡爆炸了");
    }
}
